Showing posts with label Database Programming with SQL. Show all posts
Showing posts with label Database Programming with SQL. Show all posts

Saturday, October 15, 2016

06 Logical Comparisons and Precedence Rules


  • ·         Inverts the value of the condition- NOT
  • ·         Both conditions must be true for a record to be selected-AND
  • ·         Rules that determine the order in which expressions are evaluated and calculated-precedence rules
  • ·         Either condition can be true for a record to be selected-OR


1. Execute the two queries below. Why do these nearly identical statements produce two different results? Name the difference and explain why.
SELECT code, description
FROM d_themes
WHERE code >200 AND description IN('Tropical', 'Football', 'Carnival');
SELECT code, description
FROM d_themes
WHERE code >200 OR description IN('Tropical', 'Football', 'Carnival');
First uses AND, so either the sides must return true, but in second case – OR, more records may come, because either of the sides need to be true for row selection.

2. Display the last names of all Global Fast Foods employees who have “e” and “i” in their last names.
SELECT last_name
FROM f_staffs
WHERE  last_name LIKE '%e%' AND last_name LIKE '%i%';
LAST_NAME
Miller 
3. I need to know who the Global Fast Foods employees are that make more than $6.50/hour and their position is not order taker.
SELECT first_name  ||  ' '  || last_name  as "Full Name"
FROM f_staffs
WHERE  salary > 6.5 AND staff_type = 'Order Taker';
Full Name
Sue Doe
4. Using the employees table, write a query to display all employees whose last names start with “D” and have “a” and “e” anywhere in their last name.
SELECT first_name  ||  ' '  || last_name  as "Full Name"
FROM employees
WHERE  last_name LIKE 'D%' AND last_name LIKE '%a%' AND last_name LIKE '%e%';
Full Name
Curtis Davies
Lex De Haan
5. In which venues did DJs on Demand have events that were not in private homes?

/*did DJs on Demand have events , suggest I need not all venues except private home, but also the one where actually actually event occurred*/
SELECT DISTINCT d_venues.loc_type
FROM  d_events  JOIN d_venues   ON  d_events.venue_id = d_venues.id
WHERE d_venues.loc_type != 'Private Home';
LOC_TYPE
Hotel
6. Which list of operators is in the correct order from highest precedence to lowest precedence?
a. AND, NOT, OR
b. NOT, OR, AND
c. NOT, AND, OR  (this is right, not is the highest, and in bw, or at last)
For questions 7 and 8, write SQL statements that will produce the desired output.
7. Who am I?
I was hired by employer after May 1998 but before June of 1999. My salary is less than $8000 a year and I have an “en” in my last name. (Assume that salary in table is yearly)
SELECT first_name  ||  ' '  || last_name  as "Full Name"
FROM employees
WHERE hire_date > '31-May-1998' AND hire_date < '01-Jun-1999' AND salary < 8000 AND last_name like '%en%';
Full Name
Diana Lorentz
8. What's my email address?
Because I have been working for employer since the beginning of 1996, I make more than $9000 per month. Because I make so much money, I don't get a commission.
 (Assume that table has monthly salary)
Assume that beginning of year is Quarter 1

SELECT LOWER(email) ||  '@institutedomain.com'  as "Email Address"
FROM employees
WHERE  salary > 9000 AND (commission_pct = 0 OR commission_pct IS NULL)  AND hire_date >= '01-Jan-1996' AND hire_date <= '31-Mar-1996'  ;

Email Address

mhartste@institutedomain.com

05 Comparison Operators


  • ·         This option identifies that the escape characters should be interpreted literally -ESCAPE
  • ·         Condition tests for null values- IS NULL
  • ·         Displays rows based on a range of values-BETWEEN
  • ·         Including the specified limits and the area between them; the numbers 1-10, inclusive-inclusive
  • ·         Selects rows that match a character pattern-LIKE
  • ·         Tests for values in a specified list of values-IN 


1.      Display the first name, last name, and salary of all Global Fast Foods staff whose salary is between $5.00 and $10.00 per hour.

SELECT first_name, last_name, salary
FROM f_staffs
WHERE salary BETWEEN 5 AND 10;

2. Display the location type and comments for all DJs on Demand venues that are Private Home.

SELECT loc_type, comments
FROM d_venues
WHERE loc_type = 'Private Home';

3. Using only the less than, equal, or greater than operators, rewrite the following query:
SELECT first_name, last_name
FROM f_staffs
WHERE salary BETWEEN 20.00 and 60.00;

SELECT first_name, last_name
FROM f_staffs
WHERE salary >= 20.00  and salary  <= 60.00;

4. Create a list of all the DJs on Demand CD titles that have “a” as the second letter in the title.

SELECT title
FROM d_cds
WHERE title LIKE  '_a%';

5. Who are the partners of DJs on Demand who do not get an authorized expense amount?

SELECT *
FROM d_partners
WHERE auth_expense_amt = 0 OR auth_expense_amt  IS NULL;

6. Select all the employees whose last names end with “s”. Change the heading of the column to read Possible Candidates.


SELECT first_name  ||  ' '  || last_name  as "Possible Candidates"
FROM employees
WHERE last_name LIKE '%s';
7. Which statement(s) are valid?
a. WHERE quantity <> NULL;
b. WHERE quantity = NULL;
c. WHERE quantity IS NULL;
d. WHERE quantity != NULL;
8. Write a SQL statement that lists the songs in the DJs on Demand inventory that are type code 77, 12, or 1.

SELECT title as "Song"
FROM d_songs

WHERE type_code IN (77, 12 , 1);

04 Limit Rows Selected


  • ·         Restricts the rows returned by a select statement –Where Clause
  • ·         Compares one expression to another value or expression – Comparison Operator

1. Using the Global Fast Foods database, retrieve the customer’s first name, last name, and address for the customer who uses ID 456.
SELECT first_name as "first name", last_name as "last name", address || ', ' || city || ', ' || state || '-' || zip || CHR(10) || '(Phone-' || phone_number || ')'  as "address"
FROM f_customers
WHERE id = 456; 

2. Show the name, start date, and end date for Global Fast Foods' promotional item “ballpen and highlighter” giveaway.
SELECT name, start_date as "start date", end_date as "end date"
FROM f_promotional_menus
WHERE give_away = 'ballpen and highlighter';

3. Create a SQL statement that produces the following output:
Oldest
The 1997 recording in our database is The Celebrants Live in Concert
SELECT 'The ' || year ||' recording in our database is '|| title  as "Oldest"
FROM d_cds
WHERE year = (SELECT MIN(year) FROM d_cds);

4. The following query was supposed to return the CD title “Carpe Diem" but no rows were returned. Correct the mistake in the statement and show the output.
SELECT produce, title
FROM d_cds
WHERE title = 'carpe diem' ;
SELECT producer, title
FROM d_cds
WHERE title = 'Carpe Diem' ;
Or in case only title has to be returned:
SELECT   title
FROM d_cds
WHERE title = 'Carpe Diem' ;


5. The manager of DJs on Demand would like a report of all the CD titles and years of CDs that were produced before 2000.
SELECT title, year
FROM d_cds
WHERE year < 2000;

6. Which values will be selected in the following query?
SELECT salary
FROM employees
WHERE salary < = 5000;
a. 5000
b. 0 - 4999
c. 2500
d. 5
All of the above

For the next three questions, use the following table information:
TABLE NAME: students
COLUMNS:
studentno NUMBER(6)
fname VARCHAR2(12)
lname VARCHAR(20)
sex CHAR(1)
major VARCHAR2(24)
7. Write a SQL statement that will display the student number (studentno), first name (fname), and last name (lname) for all students who are female (F) in the table named students.
SELECT studentno as "student number", fname as "first name", lname as "last name"
FROM students
WHERE sex = 'F';
8. Write a SQL statement that will display the student number (studentno) of any student who has a PE major in the table named students. Title the studentno column Student  Number.
SELECT studentno as "Student Number"
FROM students
WHERE major = 'PE';
9. Write a SQL statement that lists all information about all male students in the table named students.
SELECT *
FROM students
WHERE sex = 'M';

10. Write a SQL statement that will list the titles and years of all the DJs on Demand CDs that were not produced in 2000.
SELECT title, year
FROM d_cds
WHERE year != 2000;

11. Write a SQL statement that lists the Global Fast Foods employees who were born before 1980.
SELECT *
FROM f_staffs

WHERE birthdate  <  '01-JAN-1980';

03 Working with Columns, Characters, and Rows

  • ·         A command that suppresses duplicates - DISTINCT
  • ·         Links two columns together to form one character data column -Concatenation Operator
  • ·         A group of character data- Literal Values e.g. string
  • ·         An SQL plus command that displays the structure of a table- DESCRIBE 


1. The manager of Global Fast Foods would like to send out coupons for the upcoming sale. He wants to send one coupon to each household. Create the SELECT statement that returns the customer last name and a mailing address.
SELECT last_name as "Last Name", address || ', ' || city || ', ' || state || '-' || zip || CHR(10) || '(Phone-' || phone_number || ')'  as "Mailing Address"
FROM f_customers;

2. Each statement below has errors. Correct the errors and execute the query in Oracle
Application Express.
a.
SELECT first name
FROM f_staffs;
SELECT first_name as "First Name"
FROM f_staffs;
b.
SELECT first_name |" " | last_name AS "DJs on Demand Clients"
FROM d_clients;
SELECT first_name ||' ' || last_name AS "DJs on Demand Clients"
FROM d_clients;

c.
SELECT DISCTINCT f_order_lines
FROM quantity;
SELECT DISTINCT quantity
FROM  f_order_lines;
d.
SELECT order number
FROM f_orders;
SELECT order_number
FROM f_orders;

3. Sue, Bob, and Monique were the employees of the month. Using the f_staffs table, create
a SELECT statement to display the results as shown in the Super Star chart.
Super  Star
*** Sue *** Sue ***
*** Bob *** Bob ***
*** Monique *** Monique ***
SELECT '***' || first_name || '***' || first_name || '***' as "Super Star"
 FROM f_staffs;

4. Which of the following is TRUE about the following query?
SELECT first_name, DISTINCT birthdate
FROM f_staffs;
a. Only two rows will be returned.
b. Four rows will be returned.
c. Only Fred 05-Jan-1988 and Lizzie 10-Nov-1987 will be returned.
d. No rows will be returned.
ORA-00936: missing expression

5. Global Fast Foods has decided to give all staff members a 5% raise. Prepare a report that
presents the output as shown in the chart.
EMPLOYEE LAST NAME
 CURRENT SALARY
 SALARY WITH 5% RAISE
SELECT last_name as "EMPLOYEE LAST NAME", salary as "CURRENT SALARY", ROUND(salary*1.05, 2) as "SALARY WITH 5% RAISE"
FROM f_staffs;

6. Create a query that will return the structure of the Oracle database EMPLOYEES table.
Which columns are marked “nullable”? What does this mean?
DESCRIBE employees;
first_name , phone_number, salary, commison_pct, manager_id, department_id and bonus are nullable.
 It means that row is valid even if the fields corresponding to these columns do not contain any data.

7. The owners of DJs on Demand would like a report of all items in their D_CDs table with
the following column headings: Inventory Item, CD Title, Music Producer, and Year
Purchased. Prepare this report.
SELECT cd_number as "Inventory Item", title as "CD Title", producer as "Music Producer", year as "Year Purchased"
FROM d_cds;


8. True/False -- The following SELECT statement executes successfully: (True)
SELECT last_name, job_id, salary AS Sal
FROM employees;

9. True/False -- The following SELECT statement executes successfully: (True)
SELECT *
FROM job_grades;

10.There are four coding errors in this statement. Can you identify them?
SELECT employee_id, last_name
sal x 12 ANNUAL SALARY
FROM employees;
SELECT employee_id, last_name, salary*12 "ANNUAL SALARY"
FROM employees;

11.In the arithmetic expression salary*12 - 400, which operation will be evaluated first?
* the Multiplication

12.Which of the following can be used in the SELECT statement to return all columns of data
in the Global Fast Foods f_staffs table?
a. column names
b. *
c. DISTINCT id
d. both a and b
SELECT *
FROM f_staffs ;

13.Using SQL to choose the columns in a table uses which capability?
a. selection
b. projection
c. partitioning
d. join
SELECT  c1, c2

14.SELECT last_name AS "Employee". The column heading in the query result will appear
as:
a. EMPLOYEE
b. employee
c. Employee
d. "Employee:
c because whatever is in “”, is printed as is for column name.
15.Which expression below will produce the largest value? Salary = 20
a. SELECT salary*6 + 100  ::  It gives 220
b. SELECT salary* (6 + 100) :: It gives 2120
c. SELECT 6(salary+ 100) :: It gives error
d. SELECT salary+6*100 :: it gives 602
* has higher precedence than +, but this is overcome by ().

16.Which statement below will return a list of employees in the following format?
Mr./Ms. Steven King is an employee of our company.
a. SELECT "Mr./Ms."||first_name||' '||last_name 'is an employee of our company.' AS
"Employees"
FROM employees; - error
b. SELECT 'Mr./Ms. 'first_name,last_name ||' '||'is an employee of our company.'
FROM employees; - two columns
c. SELECT 'Mr./Ms. '||first_name||' '||last_name ||' '||'is an employee of our company.' AS
"Employees"
FROM employees ; - this matches
d. SELECT Mr./Ms. ||first_name||' '||last_name ||' '||"is an employee of our company." AS
"Employees"
FROM employees

17.Which is true about SQL statements?
a. SQL statements are case-sensitive not always, I can use lower keywords and upper column names, but if I want specific case sensitive column name to be printed I could use “”
b. SQL clauses should not be written on separate lines. – We do
c. Keywords cannot be abbreviated or split across lines. – lock this option
d. SQL keywords are typically entered in lowercase; all other words in uppercase. - no

18.Which queries will return three columns each with UPPERCASE column headings?
a. SELECT "Department_id", "Last_name", "First_name"
FROM employees;
b. SELECT DEPARTMENT_ID, LAST_NAME, FIRST_NAME
FROM employees; - yes
c. SELECT department_id, last_name, first_name AS UPPER CASE
FROM employees
d. SELECT department_id, last_name, first_name
FROM employees; - yes

19.Which statement below will likely fail?
a. SELCT * FROM employees; - fail keyword wrong
b. Select * FROM employees; - will do
c. SELECT * FROM EMPLOYEES; - will do
d. SelecT* FROM employees; - will do







02 Anatomy of a SQL Statement


  • ·         Display data from two or more related tables.- join
  • ·         A symbol used to perform an operation on some values.- Arithmetic operator
  • ·         An implementation of an attribute or relationship in a table.- column
  • ·         The capability in SQL to choose the columns in a table that you want returned from a query.- projection
  • ·         A value that is unavailable, unassigned, unknown, or inapplicable.- null
  • ·         Renames a column heading.- column alias
  • ·         A mathematical equation.- Arithmetic expression
  • ·         The capability in SQL to choose the rows in a table returned from a query.- selection
  • ·         Retrieves information from the database -SELECT
  • ·         Specifies the columns to be displayed. - select clause
  • ·         Specifies the table containing the column listed in the select clause from clause
  • ·         An individual SQL statement. - SQL command. (SELECT and FROM are keywords.)
  • ·         Part of a SQL statement.- clause 



Now you know the basics of a SELECT statement, it’s time to practice what you've learned.
1. Write a SQL statement that demonstrates projection and selection.
SELECT constraint_name
FROM user_constraints
WHERE table_name in (upper('f_shifts'), upper('F_STAFFS'));
2. Write a query that displays the last_name and email addresses for all the people in the DJs on Demand d_client table. The column headings should appear as “Client” and “Email Address.”


SELECT last_name AS "Client", email AS "Email Address"
FROM d_clients; 
3. The manager of Global Fast Foods decided to give all employees at 5%/hour raise + a $.50 bonus/hour. However, when he looked at the results, he couldn't figure out why the new raises were not as he predicted. Ms. Doe should have a new salary of $7.59, Mr. Miller's salary should be $11.00, and Monique Tuttle should be $63.50. He used the following query. What should he have done?
SELECT last_name, salary *.05 +.50
FROM f_staffs;
He assumed wrong that if he has to give 5% raise, he should multiply by ‘.05’. It should be multiplied by ‘1.05’ and rounded to two digits after decimal. Precedence he knows about correctly.  (*/+- grouped, */ being higher precedence than +-  and then left to right in statement  for the two in same group)
SELECT last_name, ROUND(salary*1.05 +.50, 2) as "Salary"
FROM f_staffs;

4. Which of the following would be the easiest way to see all rows in the d_songs table?
a. SELECT id, title, duration, artist, type_code
b. SELECT columns
c. SELECT *
d. SELECT all
5. If tax = 8.5% * car_cost and license = car_cost * .01%, which value will produce the largest car payment?
a. Payment = (car_cost * 1.25) + 5.00 - (tax) - (license)
b. Payment = car_cost * 1.25 + 5.00 - (tax - license)
6. In the example below, identify the keywords, the clause(s), and the statement(s):
Keywords:
SELECT employee_id, last_name
FROM employees;
Statement:
SELECT employee_id, last_name
FROM employees
Select Clause:
 SELECT employee_id, last_name
FROM Clause:
FROM employees



7. Label each example as SELECTION, PROJECTION, or JOIN.
a. Please give me Mary Adam's email address. SELECTION
b. I will need each customer's name and the order_total for their order. JOIN
c. I would like only the manager_id column, and none of the other columns. PROJECTION
8. Which of the following statements are true?
a. null * 25 = 0;
b. null * 6.00 = 6.00
c. null * .05 = null
d. (null + 1.00) + 5.00 = 5.00
9. How will the column headings be labeled in the following example?
SELECT bear_id bears, color AS Color, age “age”
FROM animals;
a. bears, color, age
b. BEARS, COLOR, AGE
c. BEARS, COLOR, age
d. Bears, Color, Age
10.Which of the following words must be in a SELECT statement in order to return all rows?
a. SELECT only
b. SELECT and FROM
c. FROM only

d. SELECT * only

01 Relational Database Technology


  • ·         An entry in a table, consisting of values for each appropriate column. -row
  • ·         The set of mandatory columns within a table that is used to enforce uniqueness of rows, and that is normally the most frequent means by which rows are accessed. – primary key
  • ·         An arrangement of data in rows and columns. -Table
  • ·         A column or set of columns that refers to a primary key in the same table or another table. –foreign key
  • ·         Collections of objects or relations, set of operators to act on those relations, and data integrity for accuracy and consistency –relational dB
  • ·         Intersection of a row and column - field
  • ·         Used to modify the table data by entering, changing, or removing rows –data manipulation language
  • ·         Creates, changes, and removes data structures from the data-base – data definition language
  • ·         Used to manage the changes made by DML statements –transaction control language
  • ·         Used to give or remove access rights to the database and the structures within it –data control language

1. The Global Fast Foods database consists of how many tables? ____ tables

SELECT  DISTINCT owner, count(table_name)
FROM all_tables
GROUP BY owner;

OWNER
COUNT(TABLE_NAME)
MDSYS
48
CTXSYS
5
OLAPSYS
2
SYSTEM
7
XDB
2
HKUMAR
35
SYS
37
But this contains tables from all the ERD’s in:
And I need for:

Specific to Global Fast Foods ERD [9] are:
·         F_ORDER_LINES
·         F_FOOD_ITEMS
·         F_PROMOTIONAL_MENUS
·         F_REGULAR_MENUS
·         F_SHIFTS
·         F_SHIFT_ASSIGNMENTS
·         F_STAFFS
·         F_CUSTOMERS
·         F_ORDERS

2. How is the F_SHIFTS table related to the F_STAFFS table?
SELECT DISTINCT  table_name from user_constraints
WHERE r_constraint_name in
(
SELECT constraint_name
FROM user_constraints
WHERE table_name in (upper('f_shifts'), upper('F_STAFFS'))
);
Above query gives an idea that, go look study tables F_ORDERS, F_SHIFT_ASSIGNMENTS
Now finally I found that, F_SHIFTS table related to the F_STAFFS – both having foreign key reference in F_SHIFT_ASSIGNMENTS.

3. What are the names of the columns in the F_CUSTOMERS table?
SELECT column_name
FROM   all_tab_cols
WHERE  table_name = 'F_CUSTOMERS'
COLUMN_NAME:
·         ID
·         FIRST_NAME
·         LAST_NAME
·         ADDRESS
·         CITY
·         STATE
·         ZIP
·         PHONE_NUMBER
4. How many rows of data have been entered in the F_PROMOTIONAL_MENUS table?
select count(*) from F_PROMOTIONAL_MENUS
Result is 2.
5. In the F_FOOD_ITEMS table, column _________ is a foreign-key column. What table and column is this key referencing?
select *
     from user_constraints
     where table_name = 'F_FOOD_ITEMS' and CONSTRAINT_TYPE = 'R';

select table_name from user_constraints
where constraint_name in
(
select r_constraint_name
     from user_constraints
     where table_name = 'F_FOOD_ITEMS' and CONSTRAINT_TYPE = 'R'
);
"REGULAR_CODE"  to "CODE" in "F_REGULAR_MENUS"
"PROMO_CODE"  to "CODE" in "F_PROMOTIONAL_MENUS"

6. List the primary key to foreign key relationships required to go from the F_SHIFTS table to the F_REGULAR_MENUS table.
·         This must be there to identify hours served. 
·         Now, ideally it should have been like this:

But seems to be, our fellow restaurant owner have separate regular menu for each shift. So ignore suggestion above.
·         Now again, values of hours served in regular menu table ['6-11am', '11-9pm']  don’t match any shift timings [8am to 12pm, 6pm to 10pm], seems to be these values on menu side are meant to be lost while this exercise J
--remove HOURS_SERVED
alter table "F_REGULAR_MENUS"  drop column "HOURS_SERVED" ;
--add SHIFT_CODE
alter table "F_REGULAR_MENUS" add  "SHIFT_CODE"  NUMBER(5, 0) ;
--give some value so that it may be set to not null later
UPDATE "F_REGULAR_MENUS"  SET "SHIFT_CODE" = 1;
--set SHIFT_CODE to not null
ALTER TABLE "F_REGULAR_MENUS" MODIFY ("SHIFT_CODE" NUMBER(5,0) CONSTRAINT "F_RMU_SHIFT_CODE_NN" NOT NULL ENABLE);
--now create the foreign key constraint
ALTER TABLE  "F_REGULAR_MENUS"  ADD CONSTRAINT "F_RMU_SHIFT_CODE_FK" FOREIGN KEY ("SHIFT_CODE")  REFERENCES  "F_SHIFTS" ("CODE")  ENABLE;

7. Which table(s) contains null values?
As per definition available at https://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_2094.htm, below mentioned query would have been sufficient to give this result:

SELECT distinct "TABLE_NAME" FROM   "USER_TAB_COLUMNS" WHERE   "NULLABLE" = 'Y' and "NUM_NULLS" > 0
Or
SELECT count(distinct "TABLE_NAME") FROM   "USER_TAB_COLUMNS" WHERE   "NULLABLE" = 'Y' and "NUM_NULLS" > 0
But,  It didn’t work as per design, due to some index issues.
So I removed the last condition in above query and manually verified each table: [10]
Table
Has some field null
EMPLOYEES
yes
LOCATIONS
no
EMP_DETAILS_VIEW
n/a
it's a view
JOBS
no
JOB_GRADES
no
REGIONS
no
COUNTRIES
no
D_CLIENTS
no
D_JOB_ASSIGNMENTS
no
D_SONGS
no
D_VENUES
no
F_ORDERS
no
F_STAFFS
yes
JOB_HISTORY
no
WF_COUNTRIES
yes
D_EVENTS
no
HTMLDB_PLAN_TABLE
yes
WF_CURRENCIES
yes
WF_SPOKEN_LANGUAGES
yes
D_PLAY_LIST_ITEMS
yes
F_PROMOTIONAL_MENUS
no
DEPARTMENTS
yes
F_FOOD_ITEMS
yes
D_PARTNERS
yes


But to verify my manual observation above, I needed something, for which I created below mentioned query:

SELECT 'SELECT  count(*) from "' ||  "TABLE_NAME"  || '" where "' ||   "COLUMN_NAME"  ||'" is null;' as query FROM   "USER_TAB_COLUMNS" WHERE   "NULLABLE" = 'Y';
This gives output like:
SELECT count(*) from "D_PARTNERS" where "EXPERTISE" is null;
(112 count)
I executed each query  generated above to verify above results.

Sample queries to verify above results (off the 112 generated):
SELECT count(*) from "DEPARTMENTS" where "MANAGER_ID" is null;
SELECT count(*) from "D_PARTNERS" where "EXPERTISE" is null;
SELECT count(*) from "D_PLAY_LIST_ITEMS" where "COMMENTS" is null;
SELECT count(*) from "EMPLOYEES" where "COMMISSION_PCT" is null;
SELECT count(*) from "F_FOOD_ITEMS" where "REGULAR_CODE" is null;
SELECT count(*) from "F_STAFFS" where "OVERTIME_RATE" is null;
SELECT count(*) from "HTMLDB_PLAN_TABLE" where "REMARKS" is null;
SELECT count(*) from "WF_COUNTRIES" where "COUNTRY_TRANSLATED_NAME" is null;
SELECT count(*) from "WF_CURRENCIES" where "COMMENTS" is null;

SELECT count(*) from "WF_SPOKEN_LANGUAGES" where "COMMENTS" is null;